<template>
  <section class="repayment-receive-detail component">
    <data-box :selectionList.sync="selectionList" :data="dataSet" ref="data-box">
      <template slot="columns">
        <el-table-column prop="gatheringAccount" label="收款账户" align="left" :show-overflow-tooltip="true" :min-width="$helper.getColumnWidth(5)"></el-table-column>
        <el-table-column prop="gatheringAccountNo" label="收款账号" :min-width="$helper.getColumnWidth(4)" :show-overflow-tooltip="true"></el-table-column>
      </template>
    </data-box>
    <div class="operate-buttons">
      <el-button @click="emitClose();selectionList =[] ">取消</el-button>
      <el-button @click="commit">确定</el-button>
    </div>
  </section>
</template>
<script lang='ts'>
import { Vue, Component, Prop, Emit } from 'vue-property-decorator'
import DataBox from '~/components/common/data-box.vue'
@Component({
  components: {
    DataBox
  }
})
export default class RepaymentReceiveDetail extends Vue {
  private selectionList: any = []
  @Prop() private dataSet
  @Emit('close') private emitClose() { }
  private commit() {
    if (this.selectionList.length > 1) return this.$message.error('只能选择单条信息，请重新选择！')
    this.emitClose()
    if (this.selectionList.length) {
      const dataBox: any = this.$refs['data-box']
      dataBox.$parent.$parent.$parent.fromData.receiveAcctname = this.selectionList[0].gatheringAccount
      dataBox.$parent.$parent.$parent.fromData.receiveAcctno = this.selectionList[0].gatheringAccountNo
    }

  }
}
</script>